<%@ page language="java" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>

<%
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
%>

<%@page import="sfeir.gwt.ergosum.client.model.Person"%>
<%@page import="sfeir.gwt.ergosum.server.service.ProfileServiceImpl"%><div id="header">
    <img src="/images/ergosum.png" height="100px"/>
    <div id="logo">
        
        <h1><a id="app_name" href="/ErgoSum.jsp">Ergosum</a></h1>
        <p>Revolutionize your contacts management</p>

    </div>
    <!-- end #logo -->
    <div id="menu">
        <ul>
            <li class="first"><a href="/ErgoSum.jsp">Home</a></li>
            <li><a href="/Android.jsp">Android</a></li>
            <% if (user != null) { %>
	            <li><a id="import" style="display: none;" href="#">Import</a></li>
	            <%
	               Person p = new ProfileServiceImpl().getUserProfile();
	               String url = "/ViewProfile.jsp";
	               if (p != null) {
	                   url = "/profile/" + p.getAlias();
	               }
	            %>
	            <li><a href="<%= url %>">View profile</a></li>
	            <li><a href="/EditProfile.jsp">Edit profile</a></li>
            <% } %>
            <li><a href="/Faq.jsp">FAQ</a></li>
        </ul>
    </div>
<% if (user != null) { %>
<p id="header_user">Hello, <%= user.getNickname() %>! (You can
<a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">Log out</a>.)</p>

<%
  } else {
%>
<p id="header_user">Hello!
<a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Log in</a>
</p>
<%
  }
%>
</div>
